package top.zsyle.basic.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import top.zsyle.basic.interceptor.LoginInterceptor;


@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor interceptor;

    /**
     * 添加拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(interceptor)
                .addPathPatterns("/**")//拦截所有的请求
                .excludePathPatterns("/login/**")//配置白名单
                .excludePathPatterns("/verifyCode/**")
                .excludePathPatterns("/fastDfs/**")
                .excludePathPatterns("/shop/settlement")
                .excludePathPatterns("/user/register/**");

    }
}
